﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;
using System.Globalization;

namespace Carbon.Web.Forms
{
    internal sealed class ConvertInvariant
    {
        // Methods
        public static bool ToBoolean(object value)
        {
            return Convert.ToBoolean(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static bool ToBoolean(string value)
        {
            return Convert.ToBoolean(value, CultureInfo.InvariantCulture);
        }

        public static byte ToByte(object value)
        {
            return Convert.ToByte(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static byte ToByte(string value)
        {
            return Convert.ToByte(value, CultureInfo.InvariantCulture);
        }

        public static char ToChar(object value)
        {
            return Convert.ToChar(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static char ToChar(string value)
        {
            return Convert.ToChar(value, CultureInfo.InvariantCulture);
        }

        public static DateTime ToDateTime(object value)
        {
            return Convert.ToDateTime(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static DateTime ToDateTime(string value)
        {
            return Convert.ToDateTime(value, CultureInfo.InvariantCulture);
        }

        public static decimal ToDecimal(object value)
        {
            return Convert.ToDecimal(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static decimal ToDecimal(string value)
        {
            return Convert.ToDecimal(value, CultureInfo.InvariantCulture);
        }

        public static double ToDouble(object value)
        {
            return Convert.ToDouble(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static double ToDouble(string value)
        {
            return Convert.ToDouble(value, CultureInfo.InvariantCulture);
        }

        public static short ToInt16(object value)
        {
            return Convert.ToInt16(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static short ToInt16(string value)
        {
            return Convert.ToInt16(value, CultureInfo.InvariantCulture);
        }

        public static int ToInt32(object value)
        {
            return Convert.ToInt32(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static int ToInt32(string value)
        {
            return Convert.ToInt32(value, CultureInfo.InvariantCulture);
        }

        public static long ToInt64(object value)
        {
            return Convert.ToInt64(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static long ToInt64(string value)
        {
            return Convert.ToInt64(value, CultureInfo.InvariantCulture);
        }

        public static sbyte ToSByte(object value)
        {
            return Convert.ToSByte(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static sbyte ToSByte(string value)
        {
            return Convert.ToSByte(value, CultureInfo.InvariantCulture);
        }

        public static float ToSingle(object value)
        {
            return Convert.ToSingle(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static float ToSingle(string value)
        {
            return Convert.ToSingle(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(bool value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(byte value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(char value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(DateTime value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(decimal value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(double value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(short value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(int value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(long value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(object value)
        {
            return Convert.ToString(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static string ToString(sbyte value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(float value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(string value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(ushort value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(uint value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static string ToString(ulong value)
        {
            return Convert.ToString(value, CultureInfo.InvariantCulture);
        }

        public static ushort ToUInt16(object value)
        {
            return Convert.ToUInt16(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static ushort ToUInt16(string value)
        {
            return Convert.ToUInt16(value, CultureInfo.InvariantCulture);
        }

        public static uint ToUInt32(object value)
        {
            return Convert.ToUInt32(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static uint ToUInt32(string value)
        {
            return Convert.ToUInt32(value, CultureInfo.InvariantCulture);
        }

        public static ulong ToUInt64(object value)
        {
            return Convert.ToUInt64(RuntimeHelpers.GetObjectValue(value), CultureInfo.InvariantCulture);
        }

        public static ulong ToUInt64(string value)
        {
            return Convert.ToUInt64(value, CultureInfo.InvariantCulture);
        }
    }
}
